"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.accountAndPwdValidate = exports.getRandomCode = void 0;
var code_1 = require("@/common/constants/code");
var code_2 = require("../common/constants/code");
var getRandomCode = function () {
    var code = [];
    for (var i = 0; i < 4; i++) {
        var random = Math.floor(Math.random() * 9);
        code.push(random);
    }
    return code.join('');
};
exports.getRandomCode = getRandomCode;
/**
 * 账号和密码校验
 * 密码由于是被 MD5 加密的，所以无法校验
 * @param account 账号
 * @param password 密码
 */
var accountAndPwdValidate = function (account, password) {
    if (!account || !password) {
        return {
            code: code_1.NOT_EMPTY,
            message: '账号或者密码不能为空',
        };
    }
    if (!/^(?![0-9]+$)(?![a-z]+$)[a-z0-9]{5,10}$/.test(account)) {
        return {
            code: code_1.VALIDATE_ERROR,
            message: '账号校验失败，请重新输入账号',
        };
    }
    return {
        code: code_2.SUCCESS,
    };
};
exports.accountAndPwdValidate = accountAndPwdValidate;
